﻿


$(function () {
    $("#grid-students").bootgrid({
        ajax: true,
        post: function () {
            /* To accumulate custom parameter with the request object */
            return {
            };
        },
        url: urlGrid,
        formatters: {
            "link": function (column, row) {
                var components = '<button type="button" class="btn btn-primary btn-sm documents-btn" aria-label="Left Align" title="Ver información"><span class="fontelloicon icon-eye-1" aria-hidden="true"></span></button>&nbsp;' +
                    '<a type="button" class="btn btn-primary btn-sm" aria-label="Left Align" title="Editar información" href=\"Index/' + row.SocialServiceId + '\"><span class="fontelloicon  icon-edit" aria-hidden="true"></span></a>';
                return components;
            },
            "StayModalityType": function (column, row) {
                if (row.StayModalityType == "Practicas profesionales") {
                    var components = '<div  style="height: 40px; background-color: #9CF6A1">' + row.StayModalityType + ' </div>';
                }
                else { var components = '' + row.StayModalityType + ''; }
                return components;
            },
            "StayModalityTypeColorStudentName": function (column, row) {
                if (row.StayModalityType == "Practicas profesionales") {
                    var components = '<div  style="height: 40px; background-color: #9CF6A1">' + row.StudentName + ' </div>';
                }
                else { var components = '' + row.StudentName + ''; }
                return components;
            },            
            "StayModalityTypeColorStudentId": function (column, row) {
                if (row.StayModalityType == "Practicas profesionales") {
                    var components = '<div  style="height: 40px; background-color: #9CF6A1">' + row.StudentId + ' </div>';
                }
                else { var components = '' + row.StudentId + ''; }
                return components;
            },
            "StayModalityTypeColorInitialDate": function (column, row) {
                if (row.StayModalityType == "Practicas profesionales") {
                    var components = '<div  style="height: 40px;background-color: #9CF6A1">' + row.InitialDate + ' </div>';
                }
                else { var components = '' + row.InitialDate + ''; }
                return components;
            },
            "StayModalityTypeColorEndDate": function (column, row) {
                if (row.StayModalityType == "Practicas profesionales") {
                    var components = '<div style="height: 40px; background-color: #9CF6A1">' + row.EndDate + ' </div>';
                }
                else { var components = '' + row.EndDate + ''; }
                return components;
            },
        },
        labels: {
            noResults: "Ningún elemento encontrado",
            infos: "Mostrando del {{ctx.start}} al {{ctx.end}} de {{ctx.total}} elemento(s)",
            loading: "Cargando",
            refresh: "Actualizar",
            search: "Buscar"
        },
        columnSelection: false,
        rowCount: 10
    });
    $("#sel-status").bind('change', function () {
        $("#grid-data").bootgrid("reload");
    });
});
